package com.jprocms.module.cms.dal.mysql.imgblock;

import java.io.Serializable;
import java.util.*;

import com.jpro.framework.common.pojo.PageResult;
import com.jpro.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jpro.framework.mybatis.core.mapper.BaseMapperX;
import com.jprocms.module.cms.dal.dataobject.content.ContentDO;
import com.jprocms.module.cms.dal.dataobject.imgblock.ImgblockDO;
import org.apache.ibatis.annotations.Mapper;
import com.jprocms.module.cms.controller.admin.imgblock.vo.*;

/**
 * 飘窗板块 Mapper
 *
 * @author jprocms
 */
@Mapper
public interface ImgblockMapper extends BaseMapperX<ImgblockDO> {

    default PageResult<ImgblockDO> selectPage(ImgblockPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ImgblockDO>()
                .eqIfPresent(ImgblockDO::getSiteId, reqVO.getSiteId())
                .likeIfPresent(ImgblockDO::getName, reqVO.getName())
                .eqIfPresent(ImgblockDO::getImgblockCode, reqVO.getImgblockCode())
                .betweenIfPresent(ImgblockDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ImgblockDO::getId));
    }

    default List<ImgblockDO> selectList(ImgblockPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ImgblockDO>()
                .eqIfPresent(ImgblockDO::getSiteId, reqVO.getSiteId())
                .likeIfPresent(ImgblockDO::getName, reqVO.getName())
                .eqIfPresent(ImgblockDO::getImgblockCode, reqVO.getImgblockCode())
                .betweenIfPresent(ImgblockDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ImgblockDO::getId));
    }

    ImgblockDO findById(Serializable id);


}